﻿@model BudgetMealsUI.Models.ListViewModel<BudgetMealsModels.Entities.Meal>

@{
    ViewBag.Title = "Index";
}
@Html.ActionLink("New meal", "Edit", new { mealId = 0 })
<div class="pager">
    @Html.PageLinks(Model.Info, x => Url.Action("Index", new { page = x }))
</div>
<table>
    <tr>
        <td></td>
        <td>Appetizer</td>
        <td>MainCourse</td>
        <td>Dessert</td>
    </tr>
    @foreach (var meal in Model.PageItems)
    {
        <tr>
            <td>@Html.ActionLink(@meal.Name, "Edit", new { mealId = @meal.MealID })</td>
            <td>@meal.Appetizer.Name</td>
            <td>@meal.MainCourse.Name</td>
            <td>@meal.Dessert.Name</td>
            <td>@Html.ActionLink("Delete", "Delete", new { mealId = @meal.MealID })</td>
        </tr>
    }
</table>
<div class="pager">
    @Html.PageLinks(Model.Info, x => Url.Action("Index", new { page = x }))
</div>
@Html.ActionLink("New meal", "Edit", new { mealId = 0 })